<%@page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 
<%@page import="com.git.report.ReportModelImpl"%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>报告编写</title>
<style type="text/css">

	* { padding:0; font-size:12px;  color:#444;}
	
	body { margin:5;}

	table { border-bottom: 1px solid #CCC; border-right: 1px solid #CCC; margin:5px auto;}

	td { border-top: 1px solid #CCC; border-left: 1px solid #CCC; padding-top:5px; padding-bottom:5px; padding-left:5px; width:260px; height:22px; line-height:22px;}

	input[type="text"] { border: 1px solid #CCC; height:20px; background:#FFD}

	input[type="submit"] { font-size:12px; width: 70px; height:28px; margin-left:20px;}
	input[type="button"] { font-size:12px; width: 70px; height:28px; margin-left:20px;}
	input[type="radio"] { font-size:12px; width: 70px; height:28px; margin-left:20px;}
	input[type="reset"] { font-size:12px; width: 70px; height:28px; margin-left:20px;}
	input[type="checkbox"] { border: 1px solid #CCC; height:20px; background:#FFD}
	select {height:24px; border:1px solid #8ac;}

	textarea{font-size:12px; width: 190px; height:88px; margin-left:20px;background:#FFD}
	h2.title { font-weight:normal; margin-left:10px; margin-top:3px;}

	div.board { margin:5px; border:1px solid #CCC;}

</style>
<script type="text/javascript">


function findReport(reportPath){
	
	var url = "http://172.16.3.101:8080"+reportPath;
	window.open(url,'_blank');
}

function findMark(markCode,sessionId){
	
	var url = "http://172.16.3.101:8080/Portal_CR/HTML/afdb_connection.jsp?reportId=122&markcode="+markCode+"&sessionId="+sessionId;
	window.open(url,'_blank');
}

function updateReport(modelCode){
	var orgCode = document.getElementById("orgCode").value;
	var url = "<%=request.getContextPath() %>/ReportModelServlet?method=updateReport&modelCode="+modelCode+"&orgCode="+orgCode;
	window.open(url,'_blank');
}

function delMark(markorpto){
	if(!confirm('确定删除模版 '+markorpto+'?')){
		return;
	}
	var modelCode = document.getElementById("modelCode").value;
	window.location.href="<%=request.getContextPath() %>/ReportModelServlet?method=delCategory&markorpto="+markorpto+"&modelCode="+modelCode;

}

function delReport(ptopath,ptoname){
	if(!confirm('确定删除模版 '+ptoname+'?')){
		return;
	}
	var modelCode = document.getElementById("modelCode").value;
	window.location.href="<%=request.getContextPath() %>/ReportModelServlet?method=delCategory&markorpto="+ptopath+"&modelCode="+modelCode;

}

function url(modelCode){
	window.location.href="<%=request.getContextPath() %>/downloadfile?method=downloadfile&modelCode="+modelCode;
}

function show(modelCode){
	window.open('<%=request.getContextPath() %>/ReportModelServlet?method=edit&openword=1&modelCode='+modelCode, '_blank');
}

</script>

</head>
<body>
<div class="board">

<form id="editReportModel" name="editReportModel"  enctype="multipart/form-data" method="post" action="<%=request.getContextPath() %>/ReportModelServlet?method=saveEdit">
<h2 class="title">报告编写</h2>
<table cellpadding="0" cellspacing="0" style="width: 70%">
  <tr></tr>
  
	<tr>
		<td>模版编号 &nbsp; <c:out value="${ReportModelImpl.modelCode}"/></td>
		<td>模版名称&nbsp;<input type="text" name="modelName" value="<c:out value="${ReportModelImpl.modelName}"/>"> </td>
	</tr>
	<tr>	
		<td>创建人&nbsp;<c:out value="${ReportModelImpl.inputEr}"/></td>
		<td>创建时间&nbsp;<c:out value="${ReportModelImpl.inputTime}"/></td>
    </tr>
	<tr>
		<td>当前风险报告模版为&nbsp;
			<c:choose>
				<c:when test="${ReportModelImpl.url ==''}">
					<a href="javascript:show('<c:out value="${ReportModelImpl.modelCode}"/>')"><c:out value="${ReportModelImpl.modelName}"/>.doc</a>
				</c:when>
				<c:when test="${ReportModelImpl.url !=''}">
					<a href="javascript:url('<c:out value="${ReportModelImpl.modelCode}"/>')"><c:out value="${ReportModelImpl.url}"/></a>
				</c:when>
			</c:choose>
		
		</td>
		<td>重新上传&nbsp;<input type="file" name="riskReport" size="20" maxlength="80"></td>
	</tr>

   </table> 	
	<h2 class="title">风险报告构成</h2>
	
	<table cellpadding="0" cellspacing="0" style="width: 70%">
		 <tr>
	<c:forEach items="${risk}" var="ReportModelImpl">
		<c:set var="first" value="true"></c:set>
			<c:forEach items="${ReportModelImpl.listRsk}" var="rsk">
			<tr>
				<c:if test="${first}">
				<c:set var="first" value="false"/>
					<td width="260px" style="text-align: center;" rowspan="${fn:length(ReportModelImpl.listRsk)}"><c:out value="${ReportModelImpl.riskname.riskName}" /></td>
				</c:if>
				<td width="300px" style="text-align:left;padding-left: 20px">
						<input id="<c:out value="${rsk.rskSubType}" />" type="checkbox" 
						<c:forEach  items="${subtype}" var="subtype">
								<c:if test="${subtype == rsk.rskSubType }">
								checked="checked" 
								</c:if>	
						</c:forEach>
					name="rskSubType" value="<c:out value="${rsk.rskSubType}" />" /> <c:out value="${rsk.rskSubName}" /><br/>
				</td>
			</tr>
			</c:forEach>
		</c:forEach>
	 	</tr>
		
	</table>
	
	<table cellpadding="0" cellspacing="0" style="width: 70%">
	<tr>
		  <td  colspan="2" style="text-align: center;">
		    <input type="submit" name="Submit" value="提交" />
		    <input type="hidden" name="modelCode" value="<c:out value="${ReportModelImpl.modelCode}"/>" />
	      	<input name="reset" type ="button" value = "返回" onclick="window.location.href = '<%=request.getContextPath() %>/ReportModelServlet?edit=true'" />
	      </td> 
	</tr>
</table>

</form>

</div>
</body>
</html>
